package fox.framework.rpc.server.message.response;

import fox.framework.rpc.message.RpcHeader;

import java.util.Collection;

/**
 * @author cuichao
 * @Description: RpcServerResponseAPI
 * @Date: create in 2021/2/17 14:39
 */
public final class RpcServerResponseAPI implements RpcServerResponse {

    private RpcServerResponse response;

    public RpcServerResponseAPI(RpcServerResponse response) {
        this.response = response;
    }

    @Override
    public String getProtocol() {
        return response.getProtocol();
    }

    @Override
    public int getStatus() {
        return response.getStatus();
    }

    @Override
    public void setHeader(String name, String value) {
        response.setHeader(name, value);
    }

    @Override
    public void setStatus(int status) {
        response.setStatus(status);
    }

    @Override
    public void setContentType(String type) {
        response.setHeader(RpcHeader.CONTENT_TYPE, type);
    }

    @Override
    public void setEntityBody(Object body) {
        response.setEntityBody(body);
    }

    @Override
    public String getContentType() {
        return response.getHeader(RpcHeader.CONTENT_TYPE);
    }

    @Override
    public String getHeader(String name) {
        return response.getHeader(name);
    }

    @Override
    public Collection<String> getHeaderNames() {
        return response.getHeaderNames();
    }

    @Override
    public void setAttribute(String name, Object value) {
        response.setAttribute(name, value);
    }

    @Override
    public Object getAttribute(String name) {
        return response.getAttribute(name);
    }
}
